ExpressionΒΆ
An expression is a Lua scriptable node that drives an attribute value. The purpose of expressions is to let user build custom behaviours without the need to write plugins.
- Select the node.
- Create an expression by holding down when on the button at the right of the attribute in a Properties view, then using 'Create Expression'.
An attribute expression can have optional inputs and outputs. You can create a new input or output at any time.
- Select the expression node by clicking on the '>' button at the right of the attribute or using a Node List view.
- Add an input/output by typing its name and selecting its type using widgets of Inputs/Outputs in a Properties view, then clicking on the Add button.
- Select the expression node.
- Delete an input or output by clicking on its button in a Properties view.
You can edit the script using Lua code. By default the script set the output 'Out' to 0.
- Select the expression node.
- Edit the script by clicking on the Script 'Edit' button, then using the text editor.
Whenever an input or the script is modified, it is evaluated and sets its outputs accordingly.
Within the context of the script, the inputs and the outputs are accessed directly using their name.
For instance, an expression that has two inputs Input1
and Input2
and two outputs Output1
and Output2
, a script could be:
local mul = Input1 * Input2
local add = Input1 + Input2
Output1 = mul / add
Output2 = add / mul